home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / ingres04.lzh / source / monitor / getfilenm.c < prev    next >
Encoding:
C/C++ Source or Header  |  1985-01-23  |  831 b   |  55 lines

  1. # include    "monitor.h"
  2. # include    <ingres.h>
  3. # include    <aux.h>
  4. # include    <sccs.h>
  5.  
  6. SCCSID(@(#)getfilenm.c    8.1    12/31/84)
  7.  
  8.  
  9.  
  10. /*
  11. **  GET FILE NAME
  12. **
  13. **    This routine collects a file name up to a newline and returns a
  14. **    pointer to it.  Keep in mind that it is stored in a static
  15. **    buffer.
  16. **
  17. **    Trace Flags:
  18. **        40
  19. */
  20.  
  21. char *
  22. getfilenm()
  23. {
  24.     static char    filename[81];
  25.     register char    c;
  26.     register int    i;
  27.     register char    *p;
  28.     extern char    getch();
  29.  
  30.     Oneline = TRUE;
  31.     macinit(getch, 0, 0);
  32.  
  33.     /* skip initial spaces */
  34.     while ((c = macgetch()) == ' ' || c == '\t')
  35.         continue;
  36.  
  37.     i = 0;
  38.     for (p = filename; c > 0; )
  39.     {
  40.         if (i++ <= 80)
  41.             *p++ = c;
  42.         c = macgetch();
  43.     }
  44.     *p = '\0';
  45.     Prompt = Newline = TRUE;
  46.  
  47. #    ifdef xMTR2
  48.     if (tTf(40, 0))
  49.         printf("filename \"%s\"\n", filename);
  50. #    endif
  51.     Oneline = FALSE;
  52.     getc(Input);
  53.     return (filename);
  54. }
  55.